import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet("/requestServlet01")
public class RequestServlet01  extends HttpServlet{
    @Override
    protected void service(HttpServletRequest req,
                           HttpServletResponse resp) {
        System.out.println("请求方法:" +req.getMethod());
        System.out.println("请求URL:" +req.getRequestURL().toString());
        System.out.println("Servlet上下文的路径:" +req.getContextPath());
        System.out.println("URL中对应的Servlet的路径:" +req.getServletPath());
        System.out.println("请求URI:" +req.getRequestURI());
        System.out.println("请求的URL中的查询字符串" +req.getQueryString());
        System.out.println("请求协议和版本号:" + req.getProtocol());

    }
}
